<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>CKEDITOR.tools</title>
	<link rel="stylesheet" type="text/css" href="../test.css" />
	<script type="text/javascript" src="../../ckeditor.js"></script>
	<script type="text/javascript" src="../test.js"></script>
	<script type="text/javascript">
	//<![CDATA[
var testcase;
CKEDITOR.test.addTestCase( testcase = (function()
{
	// Local reference to the "assert" object.
	var assert = CKEDITOR.test.assert;

	return {
		test_extend : function()
		{
			var fakeFn = function() {};
			var fakeObj = { fake1 : 1, fake2 : 2 };
			var fakeArray = [ 'Test', 10, fakeFn, fakeObj ];

			var target =
			{
				prop1 : 'Test',
				prop2 : 10,
				prop3 : fakeFn,
				prop4 : fakeObj,
				prop5 : fakeArray
			};

			CKEDITOR.tools.extend( target,
				{
					prop3 : 'Wrong',
					prop6 : 'Good',
					prop7 : fakeArray
				} );

			assert.areSame( 'Test'		, target.prop1, 'prop1 doesn\'t match' );
			assert.areSame( 10			, target.prop2, 'prop2 doesn\'t match' );
			assert.areSame( fakeFn		, target.prop3, 'prop3 doesn\'t match' );
			assert.areSame( fakeObj		, target.prop4, 'prop4 doesn\'t match' );
			assert.areSame( fakeArray	, target.prop5, 'prop5 doesn\'t match' );
			assert.areSame( 'Good'		, target.prop6, 'prop6 doesn\'t match' );
			assert.areSame( fakeArray	, target.prop7, 'prop7 doesn\'t match' );
		},

		test_isArray1 : function()
		{
			assert.isTrue( CKEDITOR.tools.isArray( [] ) );
		},

		test_isArray2 : function()
		{
			assert.isFalse( CKEDITOR.tools.isArray( { length:1 } ) );
		},

		test_isArray3 : function()
		{
			assert.isFalse( CKEDITOR.tools.isArray( null ) );
		},

		test_isArray4 : function()
		{
			assert.isFalse( CKEDITOR.tools.isArray( window.x ) );
		},

		test_htmlEncode1 : function()
		{
			assert.areSame( '&lt;b&gt;Test&lt;/b&gt;', CKEDITOR.tools.htmlEncode( '<b>Test</b>' ) );
		},

		test_htmlEncode2 : function()
		{
			assert.areSame( 'Test\'s &amp; "quote"', CKEDITOR.tools.htmlEncode( 'Test\'s & "quote"' ) );
		},

		test_htmlEncode_3874 : function()
		{
			assert.areSame( 'line1\nline2', CKEDITOR.tools.htmlEncode( 'line1\nline2' ) );
		},

		test_cssStyleToDomStyle1 : function()
		{
			assert.areSame( 'backgroundColor', CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) );
		},

		test_cssStyleToDomStyle2 : function()
		{
			assert.areSame( 'cssFloat', CKEDITOR.tools.cssStyleToDomStyle( 'float' ) );
		},

		test_getNextNumber : function()
		{
			var number = CKEDITOR.tools.getNextNumber();
			assert.areSame( number +  1, CKEDITOR.tools.getNextNumber() );
			assert.areSame( number +  2, CKEDITOR.tools.getNextNumber() );
			assert.areSame( number +  3, CKEDITOR.tools.getNextNumber() );
		},

		test_trim1 : function()
		{
			assert.areSame( 'test', CKEDITOR.tools.trim( '    test   ' ) );
		},

		test_trim2 : function()
		{
			assert.areSame( 'test', CKEDITOR.tools.trim( ' \n \t  test\n  \t ' ) );
		},

		test_ltrim1 : function()
		{
			assert.areSame( 'test   ', CKEDITOR.tools.ltrim( '    test   ' ) );
		},

		test_ltrim2 : function()
		{
			assert.areSame( 'test\n  \t ', CKEDITOR.tools.ltrim( ' \n \t  test\n  \t ' ) );
		},

		test_rtrim1 : function()
		{
			assert.areSame( '    test', CKEDITOR.tools.rtrim( '    test   ' ) );
		},

		test_rtrim2 : function()
		{
			assert.areSame( ' \n \t  test', CKEDITOR.tools.rtrim( ' \n \t  test\n  \t ' ) );
		},

		test_clone : function()
		{
			var obj =
			{
				name : 'John',
				cars :
				{
					Mercedes : { color : 'blue' },
					Porsche : { color : 'red' }
				}
			};

			var clone = CKEDITOR.tools.clone( obj );

			clone.name = 'Paul';
			clone.cars.Porsche.color = 'silver';

			assert.areSame( 'John', obj.name );
			assert.areSame( 'Paul', clone.name );

			assert.areSame( 'red', obj.cars.Porsche.color );
			assert.areSame( 'silver', clone.cars.Porsche.color );
		},

		test_repeat : function()
		{
			assert.areSame( '&nbsp;&nbsp;&nbsp;', CKEDITOR.tools.repeat( '&nbsp;', 3 ) );
		},

		name : document.title
	};
})() );
//window.onload = testcase.test_htmlEncode_3874;
	//]]>
	</script>
</head>
<body>
	<iframe></iframe>
</body>
</html>
